/* =====================================================
   El Comercio - Theme Bludit
   Hoja de estilos principal
   Inspirado en elcomercio.pe - periodistico, responsive
   ===================================================== */

/* ---------- Variables ---------- */
:root {
  --ec-color-primary: #c8102e;        /* rojo elcomercio */
  --ec-color-primary-dark: #9b0c23;
  --ec-color-text: #1a1a1a;
  --ec-color-text-soft: #555;
  --ec-color-muted: #888;
  --ec-color-border: #e5e5e5;
  --ec-color-bg: #ffffff;
  --ec-color-bg-soft: #f7f7f7;
  --ec-color-bg-alt: #fafafa;
  --ec-color-link: #1a1a1a;
  --ec-color-link-hover: var(--ec-color-primary);

  --ec-font-serif: Georgia, 'Times New Roman', serif;
  --ec-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --ec-radius: 4px;
  --ec-radius-lg: 8px;
  --ec-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --ec-shadow-md: 0 4px 14px rgba(0,0,0,.08);
  --ec-container-max: 1200px;
  --ec-gap: 1rem;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ec-font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ec-color-text);
  background: var(--ec-color-bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ec-color-link); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--ec-color-link-hover); }
h1, h2, h3, h4, h5, h6 { margin: 0 0 .5em; font-weight: 700; line-height: 1.25; }
p { margin: 0 0 1em; }

/* ---------- Container ---------- */
.ec-container {
  max-width: var(--ec-container-max);
  margin: 0 auto;
  padding: 0 1rem;
}
.ec-main { min-height: 60vh; padding: 1.5rem 0 3rem; }

/* ---------- Header ---------- */
.ec-header {
  background: #fff;
  border-bottom: 1px solid var(--ec-color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.ec-header-top {
  background: #f2f2f2;
  font-size: .8rem;
  color: var(--ec-color-text-soft);
  padding: .35rem 0;
}
.ec-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}
.ec-header-row-main { min-height: 70px; padding: .75rem 0; }
.ec-header-date { text-transform: capitalize; }
.ec-header-social { display: flex; gap: .5rem; }

.ec-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--ec-color-border);
  border-radius: var(--ec-radius);
  padding: .5rem .6rem;
  cursor: pointer;
}
.ec-menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ec-color-text);
  margin: 4px 0;
  transition: transform .2s;
}

.ec-logo {
  display: inline-flex;
  align-items: center;
  font-family: var(--ec-font-serif);
}
.ec-logo img { max-height: 50px; }
.ec-logo-text {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--ec-color-primary);
  letter-spacing: -.02em;
}

.ec-header-actions { display: flex; align-items: center; gap: .5rem; }
.ec-search-toggle {
  background: transparent;
  border: 1px solid var(--ec-color-border);
  border-radius: var(--ec-radius);
  padding: .45rem .55rem;
  cursor: pointer;
  color: var(--ec-color-text);
}

/* ---------- Navbar ---------- */
.ec-navbar {
  background: #fff;
  border-top: 1px solid var(--ec-color-border);
  overflow-x: auto;
}
.ec-nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ec-nav-item { position: relative; }
.ec-nav-item > a {
  display: block;
  padding: .85rem 1rem;
  font-size: .9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--ec-color-text);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.ec-nav-item:hover > a,
.ec-nav-item.is-active > a {
  color: var(--ec-color-primary);
  border-bottom-color: var(--ec-color-primary);
}
.ec-nav-home > a { color: var(--ec-color-primary); }

/* ---------- Badges ---------- */
.ec-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .25rem .55rem;
  border-radius: var(--ec-radius);
  background: var(--ec-color-primary);
  color: #fff;
}
.ec-badge-category { background: var(--ec-color-primary); }
.ec-badge-tag { background: #2a2a2a; color: #fff; }
.ec-badge-lg { font-size: .8rem; padding: .35rem .7rem; }

/* ---------- Cards ---------- */
.ec-card { background: #fff; border-radius: var(--ec-radius); overflow: hidden; transition: transform .2s ease; }
.ec-card-link { display: block; color: inherit; }
.ec-card-link:hover { color: inherit; }
.ec-card:hover { transform: translateY(-2px); }
.ec-card-media { position: relative; overflow: hidden; background: var(--ec-color-bg-soft); aspect-ratio: 16 / 9; }
.ec-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.ec-card:hover .ec-card-media img { transform: scale(1.03); }
.ec-card-body { padding: .85rem 0; }
.ec-card-title {
  font-family: var(--ec-font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  margin: .5rem 0 .4rem;
  color: var(--ec-color-text);
}
.ec-card:hover .ec-card-title { color: var(--ec-color-primary); }
.ec-card-excerpt {
  color: var(--ec-color-text-soft);
  font-size: .9rem;
  margin: .25rem 0 .5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ec-card-date {
  display: block;
  font-size: .75rem;
  color: var(--ec-color-muted);
  margin-top: .25rem;
}

/* Variantes */
.ec-card-grid .ec-card-media { aspect-ratio: 16 / 10; }
.ec-card-grid .ec-card-title { font-size: 1.05rem; }

.ec-card-list { padding: 1rem 0; border-bottom: 1px solid var(--ec-color-border); }
.ec-card-list:last-child { border-bottom: 0; }
.ec-card-list .ec-card-link { display: grid; grid-template-columns: 130px 1fr; gap: 1rem; }
.ec-card-list .ec-card-media { aspect-ratio: 4 / 3; border-radius: var(--ec-radius); }
.ec-card-list .ec-card-title { font-size: 1.05rem; }

.ec-card-lg .ec-card-link { grid-template-columns: 220px 1fr; gap: 1.25rem; }
.ec-card-lg .ec-card-title { font-size: 1.35rem; }
.ec-card-lg .ec-card-excerpt { font-size: .95rem; -webkit-line-clamp: 4; }

.ec-card-featured { margin-bottom: 1.25rem; }
.ec-card-featured .ec-card-media { aspect-ratio: 16 / 9; border-radius: var(--ec-radius); }
.ec-card-featured .ec-card-title { font-size: 1.5rem; }
.ec-card-featured .ec-card-excerpt { font-size: 1rem; -webkit-line-clamp: 4; }

/* ---------- Hero (sticky post principal) ---------- */
.ec-hero {
  margin: 1.5rem 0 2rem;
  background: #000;
  border-radius: var(--ec-radius-lg);
  overflow: hidden;
  position: relative;
}
.ec-hero-link {
  display: block;
  color: #fff;
  position: relative;
}
.ec-hero-media { aspect-ratio: 16 / 7; overflow: hidden; }
.ec-hero-media img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.ec-hero-body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2rem 1.5rem;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.4) 60%, transparent 100%);
}
.ec-hero-title {
  font-family: var(--ec-font-serif);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  margin: .5rem 0;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.ec-hero-excerpt {
  font-size: 1.05rem;
  max-width: 700px;
  color: rgba(255,255,255,.9);
  margin: .5rem 0;
}
.ec-hero-date {
  display: inline-block;
  font-size: .8rem;
  color: rgba(255,255,255,.8);
  margin-top: .5rem;
}

/* ---------- Category Block ---------- */
.ec-category-block { margin: 2.5rem 0; }
.ec-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--ec-color-text);
}
.ec-category-title {
  font-family: var(--ec-font-serif);
  font-size: 1.4rem;
  margin: 0;
  font-weight: 800;
}
.ec-category-title a { color: var(--ec-color-text); }
.ec-category-title a:hover { color: var(--ec-color-primary); }
.ec-category-more {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ec-color-primary);
  text-transform: uppercase;
}

/* Layouts */
.ec-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.ec-cat-list {
  display: grid;
  gap: 0;
}
.ec-cat-mixto {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
}
.ec-cat-mixto .ec-cat-list {
  display: flex;
  flex-direction: column;
}

/* Latest block */
.ec-latest { margin: 2rem 0; }
.ec-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--ec-color-primary);
}
.ec-section-title {
  font-family: var(--ec-font-serif);
  font-size: 1.5rem;
  margin: 0;
  font-weight: 800;
  color: var(--ec-color-text);
}
.ec-latest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

/* ---------- Category hero (single category page) ---------- */
.ec-category-hero {
  background: var(--ec-color-bg-soft);
  padding: 2rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--ec-color-border);
}
.ec-category-hero-title {
  font-family: var(--ec-font-serif);
  font-size: 2rem;
  margin: 0;
  font-weight: 800;
}
.ec-category-hero-desc {
  color: var(--ec-color-text-soft);
  margin: .5rem 0 0;
  font-size: 1.05rem;
}
.ec-cat-list-large { display: grid; gap: 0; }
.ec-cat-list-large .ec-card-lg .ec-card-link { grid-template-columns: 260px 1fr; }

/* ---------- Article (pagina interna) ---------- */
.ec-article { max-width: 760px; margin: 0 auto; padding: 1rem 0; }
.ec-breadcrumb {
  font-size: .85rem;
  color: var(--ec-color-muted);
  margin-bottom: 1rem;
}
.ec-breadcrumb a { color: var(--ec-color-muted); }
.ec-breadcrumb a:hover { color: var(--ec-color-primary); }
.ec-bc-sep { margin: 0 .5rem; }

.ec-article-title {
  font-family: var(--ec-font-serif);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  margin: .5rem 0 1rem;
  color: var(--ec-color-text);
}
.ec-article-deck {
  font-family: var(--ec-font-serif);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--ec-color-text-soft);
  margin: 0 0 1.5rem;
  line-height: 1.4;
}
.ec-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .85rem;
  color: var(--ec-color-muted);
  padding: .75rem 0;
  border-top: 1px solid var(--ec-color-border);
  border-bottom: 1px solid var(--ec-color-border);
  margin-bottom: 1.5rem;
}
.ec-article-author strong { color: var(--ec-color-text); }

.ec-article-hero { margin: 0 0 1.5rem; }
.ec-article-hero img {
  width: 100%;
  border-radius: var(--ec-radius);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.ec-article-hero figcaption {
  font-size: .85rem;
  color: var(--ec-color-muted);
  padding: .5rem 0;
  text-align: center;
}

.ec-article-body {
  font-family: var(--ec-font-serif);
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--ec-color-text);
}
.ec-article-body p { margin: 0 0 1.25em; }
.ec-article-body h2 { font-size: 1.6rem; margin: 1.5em 0 .75em; }
.ec-article-body h3 { font-size: 1.3rem; margin: 1.25em 0 .5em; }
.ec-article-body img { margin: 1rem auto; border-radius: var(--ec-radius); }
.ec-article-body blockquote {
  border-left: 4px solid var(--ec-color-primary);
  margin: 1.5rem 0;
  padding: .5rem 1.25rem;
  font-style: italic;
  color: var(--ec-color-text-soft);
}
.ec-article-body a { color: var(--ec-color-primary); text-decoration: underline; }

.ec-article-tags {
  margin: 2rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--ec-color-border);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.ec-tags-label { font-size: .85rem; color: var(--ec-color-text-soft); margin-right: .25rem; }

.ec-related { margin: 3rem 0 1rem; }

/* ---------- Paginator ---------- */
.ec-paginator {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}
.ec-page-link {
  padding: .5rem 1rem;
  border: 1px solid var(--ec-color-border);
  border-radius: var(--ec-radius);
  background: #fff;
}
.ec-page-link:hover { background: var(--ec-color-primary); color: #fff; border-color: var(--ec-color-primary); }

/* ---------- Empty / 404 ---------- */
.ec-empty, .ec-empty-state, .ec-error-404 {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ec-color-muted);
}
.ec-error-404 h1 { font-size: 5rem; color: var(--ec-color-primary); margin: 0; }
.ec-empty-tip { font-size: .9rem; opacity: .75; }

/* ---------- Footer ---------- */
.ec-footer {
  background: #1a1a1a;
  color: rgba(255,255,255,.85);
  padding: 2.5rem 0 1.25rem;
  margin-top: 3rem;
}
.ec-footer a { color: rgba(255,255,255,.85); }
.ec-footer a:hover { color: var(--ec-color-primary); }
.ec-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.ec-footer-logo {
  font-family: var(--ec-font-serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ec-color-primary);
}
.ec-footer-slogan { font-weight: 600; margin-top: .5rem; }
.ec-footer-desc { font-size: .9rem; opacity: .75; margin-top: .5rem; }
.ec-footer-title {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 .75rem;
  color: #fff;
}
.ec-footer-list { list-style: none; padding: 0; margin: 0; }
.ec-footer-list li { padding: .2rem 0; font-size: .9rem; }
.ec-footer-social { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .85rem; }
.ec-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  font-size: .8rem;
  color: rgba(255,255,255,.65);
}
.ec-footer-powered { margin: 0; }

/* =====================================================
   Templates especiales: video.php y vivo.php
   Estilo YouTube: reproductor grande arriba,
   titulo + contenido abajo.
   ===================================================== */

/* Contenedor principal video */
.ec-video-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

/* Reproductor */
.ec-video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--ec-radius-lg);
  overflow: hidden;
  box-shadow: var(--ec-shadow-md);
}
.ec-video-frame iframe,
.ec-video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Badge en vivo (LIVE) */
.ec-live-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #ff0000;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: .25rem .55rem;
  border-radius: var(--ec-radius);
  letter-spacing: .04em;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  z-index: 2;
}
.ec-live-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: ec-live-pulse 1.4s infinite;
}
@keyframes ec-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}

/* Metadatos del video */
.ec-video-meta {
  margin-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ec-color-border);
}
.ec-video-title {
  font-family: var(--ec-font-serif);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin: .5rem 0 .75rem;
}
.ec-video-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.25rem;
  font-size: .9rem;
  color: var(--ec-color-text-soft);
}
.ec-video-views {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.ec-video-views svg { width: 16px; height: 16px; }

/* Bloque de descripcion / bajada */
.ec-video-deck {
  background: var(--ec-color-bg-soft);
  padding: 1rem 1.25rem;
  border-radius: var(--ec-radius);
  margin: 1rem 0;
  font-size: .95rem;
  color: var(--ec-color-text-soft);
}

/* Cuerpo del video (descripcion extendida) */
.ec-video-body {
  font-family: var(--ec-font-sans);
  font-size: 1rem;
  line-height: 1.65;
  margin-top: 1.25rem;
}
.ec-video-body p { margin: 0 0 1em; }
.ec-video-body h2 { font-size: 1.3rem; margin: 1.25em 0 .5em; }
.ec-video-body h3 { font-size: 1.1rem; margin: 1em 0 .5em; }

/* Layout 2 columnas para video page (reproductor + sidebar) */
.ec-video-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 2rem;
}
.ec-video-sidebar > * + * { margin-top: 1.5rem; }
.ec-sidebar-block {
  background: var(--ec-color-bg-soft);
  padding: 1rem;
  border-radius: var(--ec-radius);
}
.ec-sidebar-block h3 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ec-color-text-soft);
  margin: 0 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--ec-color-border);
}
.ec-sidebar-block ul { list-style: none; padding: 0; margin: 0; }
.ec-sidebar-block li { padding: .5rem 0; border-bottom: 1px solid var(--ec-color-border); font-size: .9rem; }
.ec-sidebar-block li:last-child { border-bottom: 0; }

/* Para pantallas pequenas, ocultar sidebar */
@media (max-width: 900px) {
  .ec-video-layout { grid-template-columns: 1fr; }
  .ec-video-sidebar { display: none; }
}

/* ---------- Live page (template vivo.php) ---------- */
.ec-live-page { max-width: 980px; }
.ec-live-title {
  text-align: center;
  margin: 1.25rem auto 0;
  max-width: 800px;
  font-size: 1.4rem;
  font-weight: 700;
}

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 900px) {
  .ec-menu-toggle { display: inline-flex; }
  .ec-navbar { display: none; max-height: 70vh; overflow-y: auto; }
  body.ec-nav-open .ec-navbar { display: block; }
  .ec-nav-list { flex-direction: column; }
  .ec-nav-item > a { border-bottom: 1px solid var(--ec-color-border); }
  .ec-cat-mixto { grid-template-columns: 1fr; gap: 1rem; }
  .ec-footer-grid { grid-template-columns: 1fr; }
  .ec-footer-bottom { flex-direction: column; gap: .5rem; text-align: center; }
}

@media (max-width: 600px) {
  .ec-hero-title { font-size: 1.5rem; }
  .ec-hero-body { padding: 1rem; }
  .ec-hero-excerpt { display: none; }
  .ec-article-title { font-size: 1.75rem; }
  .ec-article-deck { font-size: 1.05rem; }
  .ec-card-list .ec-card-link { grid-template-columns: 100px 1fr; gap: .75rem; }
  .ec-card-lg .ec-card-link,
  .ec-cat-list-large .ec-card-lg .ec-card-link { grid-template-columns: 1fr; }
  .ec-cat-list-large .ec-card-lg .ec-card-media { aspect-ratio: 16 / 9; }
  .ec-video-title { font-size: 1.25rem; }
  .ec-video-meta { margin-top: .75rem; }
}

/* Print */
@media print {
  .ec-header, .ec-footer, .ec-related, .ec-paginator { display: none; }
  body { color: #000; background: #fff; }
}

/* =====================================================
   Bloques de anuncios (AdSense via plugin adsense-pro)
   Mobile-first: sticky anchor solo visible en mobile.
   ===================================================== */
.ec-ad {
  display: block;
  text-align: center;
  margin: 1.5rem auto;
  max-width: 100%;
  overflow: hidden;
}
.ec-ad-top { margin: 0 auto 1.5rem; }
.ec-ad-bottom { margin: 2rem auto 0; }
.ec-ad-in-article { margin: 1.75rem auto; }
.ec-ad-end-article { margin: 2rem auto; }
.ec-ad-sidebar { margin: 1.5rem 0; }
.ec-ad-mobile-anchor {
  /* Solo mobile; el plugin adsense-pro ya oculta en >=768px via su CSS */
  margin: 0;
}
/* Limitar visualizacion del top leaderboard en pantallas grandes */
.ec-ad-top ins.adsbygoogle { max-width: 970px; margin: 0 auto; }



