/* ============================================
   FeediX News — Magazine Layout CSS
   Themes: oled (true-black card grid), glass (frosted glass card grid)
   Layout: full-bleed hero → category strip → responsive card grid
           1-col mobile / 2-col ≥600px / 3-col ≥1024px
   ============================================ */

/* -----------------------------------------------
   MAGAZINE WRAPPER
----------------------------------------------- */

.nh-mag-wrap {
  max-width: 1200px;
  margin: 0 auto;
}

/* -----------------------------------------------
   HERO — full-bleed, taller on magazine
----------------------------------------------- */

[data-news-theme="oled"] .nh-hero-media,
[data-news-theme="glass"] .nh-hero-media {
  height: 300px;
}

@media (min-width: 600px) {
  [data-news-theme="oled"] .nh-hero-media,
  [data-news-theme="glass"] .nh-hero-media {
    height: 380px;
  }
}

/* OLED hero: bold red left accent strip */
[data-news-theme="oled"] .nh-hero {
  border-left: 4px solid #dc2626;
}

/* Glass hero: frosted overlay block */
[data-news-theme="glass"] .nh-hero-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.90) 0%, rgba(0,0,0,0.55) 55%, transparent 100%);
}

/* -----------------------------------------------
   MAGAZINE CARD GRID
----------------------------------------------- */

#nh-feed.nh-mag-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px 12px 48px;
  background: transparent;
  border: none;
  border-radius: 0;
  min-height: 40vh;
}

@media (min-width: 600px) {
  #nh-feed.nh-mag-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 16px 16px 56px;
  }
}

@media (min-width: 1024px) {
  #nh-feed.nh-mag-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    padding: 20px 20px 64px;
  }
}

/* Empty state spans full grid width */
.nh-mag-empty {
  grid-column: 1 / -1;
}

/* -----------------------------------------------
   MAGAZINE CARD
----------------------------------------------- */

.nh-mag-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  opacity: 0;
  transform: translateY(6px);
  background: var(--nh-surface);
}

@media (prefers-reduced-motion: no-preference) {
  .nh-mag-card {
    transition: opacity 280ms ease-out, transform 280ms ease-out, box-shadow 200ms ease;
  }
}

.nh-mag-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.nh-mag-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

.nh-mag-card:active {
  opacity: 0.88;
}

.nh-mag-card:focus-visible {
  outline: 2px solid var(--nh-accent);
  outline-offset: 2px;
}

/* OLED card */
[data-news-theme="oled"] .nh-mag-card {
  background: #141414;
  border: 1px solid rgba(255,255,255,0.06);
}

[data-news-theme="oled"] .nh-mag-card:hover {
  border-color: rgba(220,38,38,0.35);
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

/* Glass card */
[data-news-theme="glass"] .nh-mag-card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.1);
}

[data-news-theme="glass"] .nh-mag-card:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(220,38,38,0.35);
}

/* -----------------------------------------------
   CARD MEDIA (16:9 aspect ratio)
----------------------------------------------- */

.nh-mag-card-media {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  overflow: hidden;
  background: var(--nh-border);
  flex-shrink: 0;
}

.nh-mag-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .nh-mag-card-img {
    transition: opacity 300ms ease, transform 400ms ease;
  }
}

.nh-mag-card-img.loaded {
  opacity: 1;
}

.nh-mag-card:hover .nh-mag-card-img {
  transform: scale(1.04);
}

.nh-mag-card-img-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--nh-border) 0%, var(--nh-surface) 100%);
}

/* Badge positioned top-left over image */
.nh-mag-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

/* -----------------------------------------------
   CARD BODY
----------------------------------------------- */

.nh-mag-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 12px 10px;
  flex: 1;
}

.nh-mag-card-headline {
  font-family: var(--nh-font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--nh-head);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.15px;
  flex: 1;
}

.nh-mag-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  flex-wrap: wrap;
}

.nh-mag-card-source {
  color: var(--nh-accent);
  font-weight: 600;
}

.nh-mag-card-time {
  color: var(--nh-meta);
  font-weight: 400;
}

/* -----------------------------------------------
   CARD ACTIONS (like / save)
----------------------------------------------- */

.nh-mag-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.nh-mag-card-actions .card-like-btn,
.nh-mag-card-actions .card-save-btn {
  color: var(--nh-meta);
  font-size: 12px;
  min-height: 30px;
  padding: 3px 2px;
}

.nh-mag-card-actions .card-like-btn:hover,
.nh-mag-card-actions .card-save-btn:hover {
  color: var(--nh-accent);
}

.nh-mag-card-actions .card-like-btn.liked {
  color: #ef4444;
}

.nh-mag-card-actions .card-save-btn.saved {
  color: var(--nh-accent);
}

/* -----------------------------------------------
   RTL support
----------------------------------------------- */

[dir="rtl"] .nh-mag-card-body {
  text-align: right;
  align-items: flex-end;
}

[dir="rtl"] .nh-mag-card-meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .nh-mag-card-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .nh-mag-card-badge {
  left: auto;
  right: 10px;
}

/* -----------------------------------------------
   REDUCED MOTION
----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .nh-mag-card {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .nh-mag-card.visible {
    opacity: 1;
    transform: none;
  }

  .nh-mag-card-img {
    transition: none;
  }

  .nh-mag-card:hover .nh-mag-card-img {
    transform: none;
  }
}
