/**
 * NewsPortal Pro — Homepage Templates Shared Styles
 */

/* ============================================================
   SHARED HOMEPAGE GRID SYSTEM
   ============================================================ */
.np-homepage { min-height: 100vh; }
.np-hp-section { margin: 40px 0; }
.np-hp-top-widgets, .np-hp-bottom { margin: 30px 0; }

.np-cin-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  gap: 24px;
}
.np-neon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.np-holo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.np-flip-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* ============================================================
   TEMPLATE 1 — CINEMATIC REVEAL
   ============================================================ */
.np-hero-cinematic {
  position: relative;
  height: 88vh;
  min-height: 560px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
  perspective: var(--np-perspective);
}
.np-hero-cinematic__bg {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center;
  transform: translateZ(-100px) scale(1.15);
  will-change: transform;
  filter: blur(0px);
}
.np-hero-cinematic__layer-mid {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.2);
  transform: translateZ(-40px) scale(1.05);
}
.np-hero-cinematic__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
  z-index: 1;
}
.np-hero-cinematic__content {
  position: relative;
  z-index: 2;
  padding: 50px 40px;
  width: 100%;
}
.np-hero-cinematic__text { max-width: 780px; color: #fff; }
.np-hero-cinematic__eyebrow {
  margin-bottom: 14px;
  display: inline-block;
  background: var(--np-primary, #e63946);
  color: #fff !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 5px 16px;
  border-radius: 3px;
}
.np-hero-cinematic__title {
  font-size: clamp(1.8rem, 4.5vw, 3.5rem);
  line-height: 1.12;
  margin-bottom: 14px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}
.np-hero-cinematic__title a { color: #fff; }
.np-hero-cinematic__title a:hover { opacity: 0.9; }
.np-hero-cinematic__excerpt { color: rgba(255,255,255,0.8); font-size: 1.05rem; margin-bottom: 16px; max-width: 560px; }
.np-hero-cinematic__meta   { color: rgba(255,255,255,0.65); font-size: 13px; }
.np-hero-cinematic__scroll-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}
.np-hero-cinematic__scroll-hint span {
  display: block;
  width: 24px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 12px;
  position: relative;
}
.np-hero-cinematic__scroll-hint span::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: rgba(255,255,255,0.7);
  animation: np-scroll-hint 1.5s ease-in-out infinite;
}
@keyframes np-scroll-hint { 0%,100%{top:6px;opacity:1} 80%{top:20px;opacity:0} }

.np-cin-card__img { position: relative; height: 180px; overflow: hidden; }
.np-cin-card__img img { width:100%; height:100%; object-fit:cover; transition: transform 0.5s ease; }
.np-cin-card:hover .np-cin-card__img img { transform: scale(1.08); }
.np-cin-card__inner { padding: 16px; }
.np-cin-card__title { font-size: 1rem; margin: 8px 0 10px; line-height: 1.3; }
.np-cin-card__title a { color: var(--np-text); }
.np-cin-card__title a:hover { color: var(--np-primary); }

/* ============================================================
   TEMPLATE 2 — EXPLODING GRID
   ============================================================ */
.np-explode-stage {
  position: relative;
  height: 85vh;
  min-height: 600px;
  background: var(--np-dark);
  overflow: hidden;
}
.np-explode-hero {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  height: 300px;
  border-radius: var(--np-radius);
  overflow: hidden;
  z-index: 5;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.np-explode-hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.5s ease;
}
.np-explode-hero:hover .np-explode-hero__bg { transform: scale(1.05); }
.np-explode-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
}
.np-explode-hero__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  z-index: 1;
}
.np-explode-hero__title { font-size: 1.2rem; margin: 8px 0 6px; }
.np-explode-hero__title a { color: #fff; }
.np-explode-card {
  width: 220px;
  background: var(--np-card-bg);
  border-radius: var(--np-radius-sm);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  z-index: 3;
  cursor: pointer;
}
.np-explode-card__img { height: 100px; overflow: hidden; }
.np-explode-card__img img { width:100%; height:100%; object-fit:cover; }
.np-explode-card__body { padding: 10px 12px; }
.np-explode-card__title { font-size: 0.85rem; line-height: 1.3; margin: 6px 0 0; }
.np-explode-card__title a { color: var(--np-text); }

/* ============================================================
   TEMPLATE 3 — ORBITAL MAGAZINE
   ============================================================ */
.np-orbital-stage {
  position: relative;
  height: 700px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 60%, #1d3557 0%, #0a0c14 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1500px;
  user-select: none;
}
.np-orbital-center {
  position: absolute;
  width: 340px;
  background: var(--np-card-bg);
  border-radius: var(--np-radius);
  overflow: hidden;
  z-index: 10;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.np-orbital-center__img img { width:100%; height:200px; object-fit:cover; }
.np-orbital-center__body { padding: 20px; }
.np-orbital-center__title { font-size: 1.1rem; margin: 8px 0 10px; }
.np-orbital-center__title a { color: var(--np-text); }
.np-orbital-hint { position: absolute; bottom: 20px; color: rgba(255,255,255,0.4); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.np-orbital-item__link { display: block; height: 100%; }
.np-orbital-item__link img { width:100%; height:100%; object-fit:cover; }
.np-orbital-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  padding: 12px;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.3s;
}
.np-orbital-item:hover .np-orbital-item__overlay { opacity: 1; }
.np-orbital-item__title { color: #fff; font-size: 0.85rem; line-height: 1.3; }

/* ============================================================
   TEMPLATE 5 — CUBE ROTATOR
   ============================================================ */
.np-cube-stage {
  background: linear-gradient(135deg, #0d1b2a, #1d3557);
  height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  perspective: 1000px;
}
.np-cube-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: rgba(0,0,0,0.2);
}
.np-cube-nav__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  border: none;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
}
.np-cube-nav__dot:hover, .np-cube-nav__dot.active { background: var(--np-primary); transform: scale(1.4); }
.np-cube__face-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, rgba(0,0,0,0.3), rgba(0,0,0,0.6));
}
.np-cube__face-content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px;
  z-index: 1;
}
.np-cube__face-title { color: #fff; font-size: 1.1rem; line-height: 1.3; margin-top: 8px; }

/* ============================================================
   TEMPLATE 7 — NEON FLUX
   ============================================================ */
.np-tpl-7 { background: #0a0a0f; color: #e5e7eb; }
.np-neon-hero {
  position: relative;
  height: 80vh;
  min-height: 500px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
}
.np-neon-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,10,20,0.95) 0%, rgba(10,10,20,0.4) 60%, transparent 100%);
}
.np-neon-hero__particles { position: absolute; inset: 0; pointer-events: none; }
.np-neon-hero__content { position: relative; z-index: 1; padding: 50px; }
.np-neon-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: var(--np-radius); overflow: hidden; }
.np-neon-card__img { height: 200px; overflow: hidden; position: relative; }
.np-neon-card__img img { width:100%; height:100%; object-fit:cover; transition: transform 0.5s; }
.np-neon-card:hover .np-neon-card__img img { transform: scale(1.07); }
.np-neon-card__img-overlay { position:absolute; inset:0; background: linear-gradient(to top, rgba(10,10,20,0.7), transparent); }
.np-neon-card__body { padding: 18px; }
.np-neon-card__title { font-size: 1rem; line-height:1.3; margin: 8px 0 10px; }
.np-neon-card__title a { color: #e5e7eb; }
.np-neon-card__title a:hover { color: #00f5ff; }

/* ============================================================
   TEMPLATE 9 — HOLOGRAPHIC DECK
   ============================================================ */
.np-tpl-9 { background: linear-gradient(135deg, #0a0020, #001a33); position: relative; }
.np-holo-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
#np-holo-canvas { width:100%; height:100%; }
.np-holo-header { text-align: center; padding: 60px 0 30px; color: rgba(0,245,255,0.9); }
.np-holo-site-title { font-size: 2.5rem; text-shadow: 0 0 30px rgba(0,245,255,0.5); }
.np-holo-tagline { color: rgba(0,245,255,0.5); margin-top: 8px; letter-spacing: 2px; font-size: 12px; text-transform: uppercase; }
.np-holo-card { background: rgba(0,245,255,0.04); backdrop-filter: blur(10px); border: 1px solid rgba(0,245,255,0.12); border-radius: var(--np-radius); overflow: hidden; }
.np-holo-card__img { height: 180px; overflow: hidden; position: relative; }
.np-holo-card__img img { width:100%; height:100%; object-fit:cover; filter: saturate(0.7) brightness(0.8); transition: filter 0.3s; }
.np-holo-card:hover .np-holo-card__img img { filter: saturate(1) brightness(1); }
.np-holo-img-overlay { position:absolute; inset:0; background: linear-gradient(to top, rgba(0,0,20,0.7), transparent); }
.np-holo-card__body { padding: 16px; }
.np-holo-card__title { color: rgba(255,255,255,0.9); font-size: 0.95rem; margin: 8px 0 10px; }
.np-holo-card__title a { color: inherit; }
.np-holo-card__title a:hover { color: #00f5ff; }
.np-holo-card__excerpt { color: rgba(255,255,255,0.45); font-size: 0.82rem; }

/* ============================================================
   TEMPLATE 14 — FLIP DECK
   ============================================================ */
.np-flip-grid .np-flip-card { height: 380px; }

/* ============================================================
   TEMPLATE 20 — TUNNEL VISION
   ============================================================ */
.np-tunnel-stage {
  height: 85vh;
  min-height: 500px;
  background: #000;
  position: relative;
  overflow: hidden;
  perspective: 400px;
  cursor: none;
}
.np-tunnel-content {
  position: absolute;
  inset: 0;
  perspective: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.np-tunnel-items { position: relative; transform-style: preserve-3d; }
.np-tunnel-item { position: absolute; width: 600px; margin-left: -300px; }
.np-tunnel-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--np-radius);
  padding: 30px;
  backdrop-filter: blur(4px);
  min-height: 200px;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.np-tunnel-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.7), rgba(0,0,0,0.4));
  border-radius: var(--np-radius);
}
.np-tunnel-card__body { position: relative; z-index: 1; }
.np-tunnel-card__body h3 a { font-size: 1.2rem; color: #fff; }

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 1024px) {
  .np-cin-grid     { grid-template-columns: repeat(2, 1fr); }
  .np-neon-grid    { grid-template-columns: repeat(2, 1fr); }
  .np-holo-grid    { grid-template-columns: repeat(2, 1fr); }
  .np-flip-grid    { grid-template-columns: repeat(2, 1fr); }
  .np-orbital-stage{ height: 500px; }
}
@media (max-width: 768px) {
  .np-cin-grid     { grid-template-columns: 1fr; }
  .np-neon-grid    { grid-template-columns: 1fr; }
  .np-holo-grid    { grid-template-columns: 1fr; }
  .np-flip-grid    { grid-template-columns: repeat(2, 1fr); }
  .np-hero-cinematic { height: 60vh; }
  .np-cube-stage   { height: 300px; }
  .np-cube { width: 280px; height: 220px; }
  .np-cube__face  { width: 280px; height: 220px; }
  .np-cube__face--front,
  .np-cube__face--back  { transform: translateZ(140px); }
  .np-cube__face--left,
  .np-cube__face--right { transform: rotateY(90deg) translateZ(140px) !important; }
  .np-cube__face--top   { transform: rotateX(90deg) translateZ(110px); }
  .np-cube__face--bottom{ transform: rotateX(-90deg) translateZ(110px); }
  .np-explode-hero { width: 280px; height: 200px; }
  .np-explode-card { width: 140px; }
  .np-orbital-stage { height: 350px; }
  .np-orbital-ring  { display: none; }
  .np-hero-cinematic__content { padding: 30px 20px; }
}
@media (max-width: 480px) {
  .np-flip-grid    { grid-template-columns: 1fr; }
  .np-neon-hero    { height: 60vh; }
  .np-tunnel-stage { height: 60vh; }
}

/* ============================================================
   POSTS GRID SYSTEM (np-posts-grid / np-posts-cols-*)
   Used by many homepage templates for article card grids
   ============================================================ */
.np-posts-grid {
  display: grid;
  gap: 24px;
}
.np-posts-cols-1 { grid-template-columns: 1fr; }
.np-posts-cols-2 { grid-template-columns: repeat(2, 1fr); }
.np-posts-cols-3 { grid-template-columns: repeat(3, 1fr); }
.np-posts-cols-4 { grid-template-columns: repeat(4, 1fr); }
.np-posts-cols-5 { grid-template-columns: repeat(5, 1fr); }
.np-posts-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* ============================================================
   COMPREHENSIVE MOBILE RESPONSIVE — ALL TEMPLATES
   Uses !important to override inline style="grid-template-columns:..."
   ============================================================ */

/* ---- Tablet (≤1024px) ---- */
@media (max-width: 1024px) {
  /* Posts grids */
  .np-posts-cols-4, .np-posts-cols-5, .np-posts-cols-6 { grid-template-columns: repeat(2, 1fr); }
  .np-posts-cols-3 { grid-template-columns: repeat(2, 1fr); }

  /* Template-4 Deep Space: 3-col article grid */
  .np-tpl-4 .container > div[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* Template-12 Morphic: 4-col card grid */
  .np-tpl-12 .np-morph-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Template-17 Cardboard Box: 4-col box grid */
  .np-tpl-17 .container > div[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* Template-18 Glass Panels: 3-col card grid */
  .np-tpl-18 div[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* Template-19 Liquid News: 4-col card grid */
  .np-tpl-19 div[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* Template-22 Prism: 6-col hero → 3 */
  .np-tpl-22 div[style*="repeat(6"] { grid-template-columns: repeat(3, 1fr) !important; height: 50vh !important; }

  /* Template-15 Newspaper: reduce columns */
  .np-tpl-15 .np-paper-cols { column-count: 2 !important; }
}

/* ---- Mobile (≤768px) ---- */
@media (max-width: 768px) {
  /* Posts grids → single column */
  .np-posts-cols-2,
  .np-posts-cols-3,
  .np-posts-cols-4,
  .np-posts-cols-5,
  .np-posts-cols-6 { grid-template-columns: 1fr; }

  /* Template-4 Deep Space: 3-col → 1-col */
  .np-tpl-4 .container > div[style*="repeat(3"] { grid-template-columns: 1fr !important; }

  /* Template-12 Morphic: 4-col → 1-col */
  .np-tpl-12 .np-morph-grid { grid-template-columns: 1fr !important; }

  /* Template-17 Cardboard Box: 4-col → 1-col */
  .np-tpl-17 .container > div[style*="repeat(4"] { grid-template-columns: 1fr !important; }

  /* Template-18 Glass Panels: hero 1.8fr/1fr → stacked */
  .np-tpl-18 div[style*="1.8fr"] { grid-template-columns: 1fr !important; min-height: auto !important; }
  .np-tpl-18 div[style*="repeat(3"] { grid-template-columns: 1fr !important; }

  /* Template-19 Liquid News: 4-col → 1-col, hero height reduce */
  .np-tpl-19 div[style*="repeat(4"] { grid-template-columns: 1fr !important; }
  .np-tpl-19 div[style*="min-height:80vh"] { min-height: 60vh !important; padding: 40px 0 !important; }

  /* Template-21 Tectonic Plates: 2-col hero → stacked */
  .np-tpl-21 div[style*="1fr 1fr"] { grid-template-columns: 1fr !important; min-height: auto !important; }
  .np-tpl-21 .np-plate { min-height: 280px !important; }
  .np-tpl-21 div[style*="bottom:60px;left:40px"] { left: 20px !important; bottom: 20px !important; max-width: 100% !important; }
  .np-tpl-21 div[style*="bottom:60px;right:40px"] { right: 20px !important; bottom: 20px !important; max-width: 100% !important; }

  /* Template-22 Prism: 6 panels → 2 stacked rows */
  .np-tpl-22 div[style*="repeat(6"] { grid-template-columns: repeat(2, 1fr) !important; height: auto !important; min-height: 60vh !important; }

  /* Template-15 Newspaper: 1 column */
  .np-tpl-15 .np-paper-cols { column-count: 1 !important; }

  /* Template-13 Depth: hero height */
  .np-tpl-13 .np-depth-hero { height: 55vh !important; }

  /* Template-4 Deep Space: hero height */
  .np-tpl-4 div[style*="min-height:90vh"] { min-height: 60vh !important; padding: 40px 20px !important; }

  /* Template-18 hero image height */
  .np-tpl-18 div[style*="min-height:350px"] { min-height: 220px !important; }
  .np-tpl-18 div[style*="min-height:400px"] { min-height: auto !important; }

  /* Template-6 Folded Paper: ensure cols respond */
  .np-tpl-6 .np-posts-grid { gap: 16px; }
}

/* ---- Small mobile (≤480px) ---- */
@media (max-width: 480px) {
  .np-posts-grid { gap: 16px; }
  .np-posts-cols-2 { grid-template-columns: 1fr; }

  /* Template-22 Prism: 2 → 1 on very small */
  .np-tpl-22 div[style*="repeat(6"] { grid-template-columns: 1fr !important; }

  /* Template-15 masthead font shrink */
  .np-tpl-15 div[style*="5rem"] { font-size: 2rem !important; }

  /* Template-4 article card images smaller */
  .np-tpl-4 article img { height: 140px !important; }
}
