/* ============================================================
   Periódico Digital / InfoNexo — estilos del sitio público
   (el "diario" que ve el lector; una instancia por cada cliente).

   --accent puede venir sobreescrito por tenant vía includes/header.php
   (columna tenants.primary_color), así cada cliente puede tener su
   propio color de marca sin tocar este archivo.
   ============================================================ */

:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-alt: #faf9f7;
  --border: #e5e3de;
  --ink: #17181a;
  --ink-soft: #5f6167;
  --ink-faint: #93959c;
  --accent: #b8121f;
  --accent-dark: #8f0d18;
  --accent-soft: #fbe9ea;
  --accent-rgb: 184, 18, 31;
  --link: #0b4f8a;
  --shadow-sm: 0 1px 2px rgba(20, 20, 20, 0.05);
  --shadow: 0 4px 16px rgba(20, 20, 20, 0.07);
  --shadow-lg: 0 12px 32px rgba(20, 20, 20, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --serif: Georgia, 'Times New Roman', Times, serif;
  --sans: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; transition: color var(--transition); }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
img { max-width: 100%; display: block; }
::selection { background: rgba(var(--accent-rgb), 0.18); }

/* ===== Topbar ===== */
.topbar { background: var(--ink); color: #fff; font-size: 12px; }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 8px 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar-date { opacity: 0.65; letter-spacing: 0.2px; }
.topbar-links a { color: #fff; opacity: 0.85; font-weight: 500; }
.topbar-links a:hover { opacity: 1; text-decoration: none; }

/* ===== Masthead ===== */
.masthead { text-align: center; padding: 30px 20px 18px; background: var(--surface); }
.masthead-title { display: inline-block; }
.masthead h1 {
  font-family: var(--serif); font-size: 44px; font-weight: 700; margin: 0;
  letter-spacing: -0.8px; color: var(--ink);
}
.masthead p {
  margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
}

/* ===== Nav ===== */
.main-nav {
  background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow-sm);
}
.main-nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.main-nav-links { list-style: none; display: flex; flex-wrap: wrap; margin: 0; padding: 0; }
.main-nav-links li a {
  display: block; padding: 15px 14px; color: var(--ink); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.main-nav-links li a:hover { color: var(--accent); text-decoration: none; }
.main-nav-links li a.active { color: var(--accent); border-bottom-color: var(--accent); }

.search-form { display: flex; align-items: center; padding: 10px 0; gap: 0; }
.search-form input {
  border: 1px solid var(--border); background: var(--surface-alt); border-radius: 999px 0 0 999px;
  padding: 8px 14px; font-size: 13px; width: 180px; font-family: inherit; border-right: none;
}
.search-form input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.search-form button {
  border: 1px solid var(--ink); background: var(--ink); color: #fff; padding: 8px 14px;
  border-radius: 0 999px 999px 0; cursor: pointer; font-size: 13px; transition: background var(--transition);
}
.search-form button:hover { background: var(--accent); border-color: var(--accent); }

/* ===== Layout general ===== */
.content-layout {
  max-width: 1200px; margin: 0 auto; padding: 32px 24px 60px;
  display: grid; grid-template-columns: 1fr 300px; gap: 40px; align-items: start;
}
.content-main { min-width: 0; }
.content-sidebar { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 78px; }

.section-heading {
  font-family: var(--serif); font-size: 23px; font-weight: 700; border-bottom: 3px solid var(--ink);
  padding-bottom: 10px; margin: 40px 0 20px; display: flex; align-items: baseline; gap: 10px;
}
.content-layout > .content-main > .section-heading:first-child,
.hero-article + .section-heading { margin-top: 0; }
.section-heading--category { border-bottom-color: var(--accent); }
.category-description { color: var(--ink-soft); margin-top: -10px; margin-bottom: 24px; font-size: 15px; }
.empty-message {
  color: var(--ink-soft); padding: 32px 24px; text-align: center; background: var(--surface);
  border: 1px dashed var(--border); border-radius: var(--radius); font-size: 14px;
}

/* ===== Ad slots ===== */
.ad-slot { display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: var(--radius-sm); }
.ad-slot img { margin: 0 auto; border-radius: var(--radius-sm); }
.ad-slot--empty {
  border: 1px dashed #cfcdc6; border-radius: var(--radius); background: var(--surface-alt);
  color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  min-height: 90px; text-align: center; padding: 10px; width: 100%;
}
.ad-slot-label {
  position: absolute; font-size: 10px; text-transform: uppercase; color: var(--ink-faint);
  background: var(--surface); padding: 1px 6px; margin-top: -8px; letter-spacing: 0.5px; border-radius: 3px;
}
.header-ad-slot, .footer-ad-slot { display: flex; justify-content: center; padding: 16px 24px; background: var(--surface); }
.sidebar-ad-slot, .in-article-ad-slot { position: relative; margin: 24px 0; display: flex; justify-content: center; }

/* ===== Hero / tarjeta destacada ===== */
.hero-article { margin-bottom: 12px; }
.article-card--hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center;
  background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.article-card--hero .article-card-media { border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16/10; background: #ddd; margin-bottom: 0; }
.article-card--hero .article-card-media img { width: 100%; height: 100%; object-fit: cover; }
.article-card--hero .article-card-title { font-size: 32px; line-height: 1.12; }
.article-card--hero .article-card-excerpt { font-size: 16px; }

/* ===== Grilla de notas ===== */
.article-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px 26px; }
.article-card { display: flex; flex-direction: column; }
.article-card-media {
  border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16/10; background: #ddd; margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.article-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 320ms ease; }
.article-card:hover .article-card-media img { transform: scale(1.05); }
.article-card-media-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, #e8e7e2, #d2d0ca); }
.article-card-category {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.article-card-title { font-family: var(--serif); font-size: 19px; font-weight: 700; line-height: 1.28; margin: 0 0 8px; }
.article-card-title a { color: var(--ink); }
.article-card-title a:hover { color: var(--accent); text-decoration: none; }
.article-card-excerpt { font-size: 14px; color: var(--ink-soft); margin: 0 0 10px; }
.article-card-meta { font-size: 12px; color: var(--ink-faint); margin-top: auto; }
.article-card--compact .article-card-title { font-size: 15px; }
.article-card--compact .article-card-media { aspect-ratio: 16/9; }

/* ===== Paginación ===== */
.pagination { display: flex; gap: 8px; margin-top: 34px; }
.pagination a {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--ink);
  font-size: 13px; font-weight: 600; background: var(--surface); transition: all var(--transition);
}
.pagination a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.pagination a.active:hover { color: #fff; }

/* ===== Sidebar widgets ===== */
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.widget-title { font-family: var(--serif); font-size: 16px; font-weight: 700; margin: 0 0 14px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.most-read-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.most-read-list li { display: flex; gap: 12px; align-items: baseline; font-size: 13px; }
.most-read-rank { font-family: var(--serif); font-weight: 700; color: var(--accent); font-size: 18px; min-width: 20px; }
.most-read-list a { color: var(--ink); font-weight: 500; }
.most-read-list a:hover { color: var(--accent); }

/* ===== Nota completa ===== */
.article-full { max-width: 760px; }
.draft-notice {
  background: #fff6e0; border: 1px solid #ffe6a3; padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 18px; font-weight: 600;
}
.article-full-category {
  display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px;
}
.article-full-title { font-family: var(--serif); font-size: 38px; font-weight: 700; line-height: 1.12; margin: 0 0 12px; }
.article-full-subtitle { font-size: 19px; color: var(--ink-soft); margin: 0 0 18px; line-height: 1.4; }
.article-full-meta {
  font-size: 13px; color: var(--ink-faint); display: flex; gap: 16px; flex-wrap: wrap;
  padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 24px;
}
.article-full-meta strong { color: var(--ink); }
.article-full-image { width: 100%; border-radius: var(--radius); margin-bottom: 24px; box-shadow: var(--shadow); }
.article-full-content { font-family: var(--serif); font-size: 18px; line-height: 1.78; color: #222; }
.article-full-content p { margin: 0 0 20px; }
.article-full-content h2 { font-size: 25px; margin: 32px 0 16px; }
.article-full-content blockquote {
  border-left: 4px solid var(--accent); margin: 24px 0; padding: 6px 22px; font-style: italic; color: var(--ink-soft);
}
.article-full-content img { border-radius: var(--radius-sm); margin: 18px 0; }

.article-tags { margin: 28px 0 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.article-tag { font-size: 12px; font-weight: 600; background: var(--accent-soft); color: var(--accent-dark); padding: 5px 12px; border-radius: 999px; }

.share-buttons { display: flex; align-items: center; gap: 10px; margin: 22px 0; font-size: 13px; color: var(--ink-soft); flex-wrap: wrap; }
.share-buttons a { border: 1px solid var(--border); padding: 7px 14px; border-radius: 999px; color: var(--ink); font-weight: 600; transition: all var(--transition); }
.share-buttons a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; background: var(--accent-soft); }

/* ===== Comentarios ===== */
.comments-section { max-width: 760px; margin-top: 48px; }
.comment-sent-notice { background: #eaf7ee; border: 1px solid #bfe6cb; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: #1e7e34; }
.comment-card { border-bottom: 1px solid var(--border); padding: 16px 0; }
.comment-card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--ink-faint); margin-bottom: 6px; }
.comment-card-meta strong { color: var(--ink); }
.comment-form { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.comment-form input, .comment-form textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; font-family: inherit; width: 100%; background: var(--surface-alt);
}
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ===== Footer ===== */
.site-footer { background: var(--ink); color: #c9c9cc; margin-top: 50px; }
.site-footer-inner { max-width: 1200px; margin: 0 auto; padding: 40px 24px 30px; text-align: center; }
.site-footer-brand strong { font-family: var(--serif); font-size: 22px; color: #fff; }
.site-footer-brand p { margin: 6px 0 20px; font-size: 13px; color: #9a9a9e; }
.site-footer-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.site-footer-links a { color: #c9c9cc; font-size: 13px; font-weight: 500; }
.site-footer-links a:hover { color: #fff; }
.site-footer-copy { font-size: 12px; color: #77777c; margin: 18px 0 0; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.08); }

/* ===== Botones genéricos (compartidos con el panel; el panel los redefine con su propia paleta) ===== */
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  padding: 10px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer;
  display: inline-block; text-align: center; transition: all var(--transition); font-family: inherit;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(var(--accent-rgb), 0.3); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-dark); }
.btn-danger { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn-small { padding: 7px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.form-error {
  color: #9a1622; background: #fdeced; border: 1px solid #f6c6ca; padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; margin: 0 0 16px;
}
.form-success {
  color: #1e7e34; background: #eaf7ee; border: 1px solid #bfe6cb; padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; margin: 0 0 16px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .content-layout { grid-template-columns: 1fr; }
  .content-sidebar { position: static; }
  .article-card--hero { grid-template-columns: 1fr; padding: 12px; }
  .masthead h1 { font-size: 32px; }
}
@media (max-width: 620px) {
  .article-grid { grid-template-columns: 1fr; }
  .main-nav-inner { flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  .search-form { padding: 10px 0 6px; }
  .search-form input { flex: 1; }
  .article-full-title { font-size: 28px; }
  .topbar-inner { flex-direction: column; gap: 2px; padding: 8px 20px; }
}
