/* ═══════════════════════════════════════════════════════
   MENER — Features
   Progress bar · Dark mode · Breaking news
   Live search · Bookmark · Views
═══════════════════════════════════════════════════════ */

/* ── Reading Progress Bar ──────────────────────────── */
#mener-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--mener-accent);
  z-index: 99999;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ── Dark Mode Toggle ──────────────────────────────── */
#mener-dark-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  padding: 0;
}
#mener-dark-toggle:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
/* moon shown by default (light mode); sun shown in dark mode */
.mener-dark-toggle__sun  { display: none; }
.mener-dark-toggle__moon { display: block; }
html.dark .mener-dark-toggle__sun  { display: block; }
html.dark .mener-dark-toggle__moon { display: none; }

/* ── Dark Mode Color Overrides ─────────────────────── */
html.dark {
  color-scheme: dark;
  --mener-body-bg:      #0d0d0d;
  --mener-text-primary: #f0f0f0;
  --mener-text-muted:   #9ca3af;
  --mener-border-color: #272727;
  --mener-card-bg:      #1a1a1a;
  --mener-surface-soft: #161616;
}

/* backgrounds */
html.dark .bg-white      { background-color: #161616 !important; }
html.dark .bg-gray-50    { background-color: #111111 !important; }
html.dark .bg-gray-100   { background-color: #1a1a1a !important; }
html.dark .bg-gray-200   { background-color: #252525 !important; }

/* text */
html.dark .text-gray-950,
html.dark .text-gray-900 { color: #f0f0f0 !important; }
html.dark .text-gray-800 { color: #e0e0e0 !important; }
html.dark .text-gray-700 { color: #cacaca !important; }
html.dark .text-gray-600 { color: #9ca3af !important; }
html.dark .text-gray-500 { color: #6b7280 !important; }

/* borders */
html.dark .border-gray-100 { border-color: #272727 !important; }
html.dark .border-gray-200 { border-color: #333    !important; }
html.dark .border-gray-300 { border-color: #404040 !important; }
html.dark .divide-gray-100 > * + * { border-color: #272727 !important; }

/* post content text */
html.dark .space-y-5 { color: #cacaca; }
html.dark .space-y-5 h2,
html.dark .space-y-5 h3,
html.dark .space-y-5 h4 { color: #f0f0f0; }
html.dark .space-y-5 blockquote {
  border-left-color: var(--mener-accent);
  background-color: #1a1a1a;
  color: #cacaca;
}
html.dark .space-y-5 code {
  background-color: #252525;
  color: #e0e0e0;
}
html.dark .space-y-5 pre { background-color: #1a1a1a; }

/* header search inputs */
html.dark .mener-header-shell input[type="text"] {
  background-color: #1a1a1a;
  border-color: #333;
  color: #f0f0f0;
}
html.dark .mener-header-shell input[type="text"]::placeholder { color: #555; }

/* shadows */
html.dark .shadow-sm  { box-shadow: 0 1px 3px rgba(0,0,0,0.6)  !important; }
html.dark .shadow-md  { box-shadow: 0 4px 12px rgba(0,0,0,0.6) !important; }

/* ── Breaking News Ticker ──────────────────────────── */
.mener-breaking {
  background: var(--mener-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1;
}
.mener-breaking__inner {
  display: flex;
  align-items: center;
  height: 32px;
}
.mener-breaking__label {
  flex-shrink: 0;
  padding: 0 1rem;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.22);
  height: 100%;
  display: flex;
  align-items: center;
}
.mener-breaking__ticker {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
}
.mener-breaking__track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  animation: mener-ticker 28s linear infinite;
  padding-left: 100%;
}
.mener-breaking__track:hover { animation-play-state: paused; }
.mener-breaking__track a {
  color: #fff;
  text-decoration: none;
  padding: 0 2rem;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.mener-breaking__track a:hover { opacity: 1; text-decoration: underline; }
.mener-breaking__track .sep { opacity: 0.35; margin: 0 .25rem; }
@keyframes mener-ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── Live Search Dropdown ──────────────────────────── */
.mener-search-wrap { position: relative; }

.mener-live-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 300px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 9999;
  overflow: hidden;
  display: none;
}
html.dark .mener-live-results {
  background: #1a1a1a;
  border-color: #333;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.mener-live-results.open { display: block; }

.mener-live-results__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: #111;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
}
html.dark .mener-live-results__item { color: #f0f0f0; border-color: #272727; }
.mener-live-results__item:last-of-type { border-bottom: none; }
.mener-live-results__item:hover { background: #f9fafb; }
html.dark .mener-live-results__item:hover { background: #222; }

.mener-live-results__thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #e5e7eb;
}
html.dark .mener-live-results__thumb { background: #2a2a2a; }

.mener-live-results__cat {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--mener-accent);
  margin-bottom: 2px;
}
.mener-live-results__title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mener-live-results__msg {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
}
.mener-live-results__footer {
  padding: 8px 14px;
  background: #f9fafb;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  border-top: 1px solid #f3f4f6;
}
html.dark .mener-live-results__footer { background: #111; border-color: #272727; }
.mener-live-results__footer a { color: var(--mener-accent); text-decoration: none; }
.mener-live-results__footer a:hover { text-decoration: underline; }

/* ── Bookmark Button ───────────────────────────────── */
.mener-bookmark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
}
html.dark .mener-bookmark-btn { border-color: #333; }
.mener-bookmark-btn:hover {
  border-color: var(--mener-accent);
  color: var(--mener-accent);
}
.mener-bookmark-btn.saved {
  background: var(--mener-accent);
  border-color: var(--mener-accent);
  color: #fff;
}

/* ── Post View Count ───────────────────────────────── */
.mener-views {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #9ca3af;
}

/* ── Video Carousel ────────────────────────────────── */
.mener-video-carousel { position: relative; }

.mener-video-carousel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.mener-video-carousel__title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--mener-text-primary, #111);
}

.mener-video-carousel__nav {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mener-video-carousel__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.mener-video-carousel__btn:hover {
  background: #111;
  border-color: #111;
  color: #fff;
}

html.dark .mener-video-carousel__btn {
  border-color: #333;
  color: #d1d5db;
}

html.dark .mener-video-carousel__btn:hover {
  background: #fff;
  border-color: #fff;
  color: #111;
}

/* Track — CSS scroll snap, hidden scrollbar */
.mener-video-carousel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc(
    (100% - (var(--vc-visible, 3.7) - 1) * 12px) / var(--vc-visible, 3.7)
  );
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.mener-video-carousel__track::-webkit-scrollbar { display: none; }

/* Responsive: override card width at smaller viewports */
@media (max-width: 479px) {
  .mener-video-carousel__track {
    grid-auto-columns: calc((100% - 12px) / 1.3);
  }
}
@media (min-width: 480px) and (max-width: 767px) {
  .mener-video-carousel__track {
    grid-auto-columns: calc((100% - 24px) / 2.3);
  }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .mener-video-carousel__track {
    grid-auto-columns: calc((100% - 24px) / 2.7);
  }
}

/* Card */
.mener-video-card {
  scroll-snap-align: start;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  outline: none;
}

.mener-video-card:focus-visible {
  box-shadow: 0 0 0 3px var(--mener-accent, #0073ea);
}

.mener-video-card__thumb {
  width: 100%;
  aspect-ratio: var(--vc-ratio, 9/16);
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.mener-video-card__thumb--empty {
  aspect-ratio: var(--vc-ratio, 9/16);
  background: #1a1a1a;
}

.mener-video-card:hover .mener-video-card__thumb {
  transform: scale(1.04);
}

/* Overlay gradient + slots */
.mener-video-card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.78) 30%,
    rgba(0, 0, 0, 0.08) 65%,
    transparent 100%
  );
  transition: background 0.2s;
}

.mener-video-card:hover .mener-video-card__overlay {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 30%,
    rgba(0, 0, 0, 0.15) 65%,
    rgba(0, 0, 0, 0.05) 100%
  );
}

.mener-video-card__duration {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.6;
  min-height: 20px;
}

/* Play button — centered via absolute */
.mener-video-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s, background 0.18s;
}

.mener-video-card:hover .mener-video-card__play {
  background: #fff;
  transform: translate(-50%, -50%) scale(1.12);
}

.mener-video-card__play-icon {
  width: 16px;
  height: 16px;
  color: #111;
  margin-left: 2px; /* optical center for play triangle */
}

.mener-video-card__title {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  align-self: flex-end;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ── Video Lightbox ────────────────────────────────── */
.mener-video-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mener-video-lightbox.open { display: flex; }

.mener-video-lightbox__inner {
  position: relative;
  width: 100%;
  max-width: 860px;
}

/* Portrait mode — narrower box for Shorts */
.mener-video-lightbox.portrait .mener-video-lightbox__inner {
  max-width: 380px;
}

.mener-video-lightbox__close {
  position: absolute;
  top: -44px;
  right: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}

.mener-video-lightbox__close:hover { color: #fff; }

.mener-video-lightbox__ratio {
  position: relative;
  padding-top: 56.25%; /* 16:9 default */
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

.mener-video-lightbox.portrait .mener-video-lightbox__ratio {
  padding-top: 177.78%; /* 9:16 for Shorts */
}

.mener-video-lightbox__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
