/* ==========================================================================
   ESTILO INSTITUCIONAL & MINIMALISTA - ORÁN SOLUCIONES
   Diseño sobrio, limpio y profesional (Portal Institucional / Novedades FB)
   ========================================================================== */

:root {
  /* Paleta Institucional */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --bg-subtle: #f1f5f9;

  --navy-primary: #0f2744;     /* Azul marino institucional */
  --navy-dark: #0a192f;
  --blue-accent: #1d4ed8;     /* Azul formal */
  --blue-hover: #1e40af;
  --blue-fb: #1877f2;

  --text-primary: #0f172a;    /* Texto principal de alto contraste */
  --text-secondary: #475569;  /* Texto de apoyo */
  --text-muted: #64748b;      /* Metadatos y fechas */

  --border-color: #e2e8f0;    /* Bordes sutiles y limpios */
  --border-focus: #cbd5e1;

  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --success-border: #a7f3d0;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-family);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   TOP BAR INSTITUCIONAL
   ========================================================================== */
.top-bar {
  background-color: var(--navy-dark);
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.api-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
}

/* ==========================================================================
   HEADER PRINCIPAL
   ========================================================================== */
.main-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 22px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  object-fit: cover;
}

.brand-headings h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy-primary);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.brand-headings p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-institutional {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--navy-primary);
  transition: all 0.15s ease;
}

.btn-institutional:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-focus);
  text-decoration: none;
}

.btn-primary-inst {
  background-color: var(--blue-accent);
  border-color: var(--blue-accent);
  color: #ffffff;
}

.btn-primary-inst:hover {
  background-color: var(--blue-hover);
  border-color: var(--blue-hover);
  color: #ffffff;
}

/* ==========================================================================
   BANNER INSTITUCIONAL / INTRO
   ========================================================================== */
.intro-banner {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 36px 0;
  margin-bottom: 40px;
}

.intro-content {
  max-width: 800px;
}

.intro-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blue-accent);
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
}

.intro-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy-primary);
  line-height: 1.25;
  margin-bottom: 10px;
}

.intro-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   SECCIONES Y TITULARES
   ========================================================================== */
.section-block {
  margin-bottom: 50px;
}

.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--navy-primary);
  padding-bottom: 10px;
  margin-bottom: 24px;
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   PUBLICACIÓN DESTACADA (ÚLTIMA NOVEDAD)
   ========================================================================== */
.featured-post-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.featured-post-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.featured-media {
  position: relative;
  background-color: #0f172a;
  cursor: pointer;
  min-height: 320px;
}

.featured-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  background-color: var(--navy-primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.featured-content {
  padding: 32px;
  display: flex;
  flex-direction: column;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.featured-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy-primary);
  line-height: 1.35;
  margin-bottom: 14px;
}

.featured-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 24px;
  white-space: pre-line;
  flex-grow: 1;
}

.featured-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.interaction-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
}

/* ==========================================================================
   OTRAS PUBLICACIONES RECIENTES (GRID)
   ========================================================================== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px;
}

.post-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.post-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.post-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #0f172a;
  cursor: pointer;
  overflow: hidden;
}

.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card:hover .post-card-thumb img {
  transform: scale(1.02);
}

.post-badge-subtle {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(15, 23, 42, 0.85);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.post-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-card-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.post-card-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  font-size: 0.82rem;
}

/* ==========================================================================
   DIAGNÓSTICO DEL TOKEN / API INFO
   ========================================================================== */
.api-diagnostic-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--blue-accent);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-top: 40px;
}

.diagnostic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.diagnostic-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy-primary);
}

.diagnostic-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.token-preview {
  display: inline-block;
  font-family: monospace;
  background-color: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--navy-primary);
  border: 1px solid var(--border-color);
}

/* ==========================================================================
   MODAL PARA LECTURA COMPLETA
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  background-color: #ffffff;
  border-radius: var(--radius-md);
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: var(--text-secondary);
}

.modal-close-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.modal-media-full {
  background-color: #0f172a;
  max-height: 380px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-media-full img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
}

.modal-content-full {
  padding: 28px;
}

.modal-post-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.65;
  white-space: pre-line;
  margin: 16px 0 24px;
}

/* ==========================================================================
   FOOTER INSTITUCIONAL
   ========================================================================== */
.institutional-footer {
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 30px 0;
  margin-top: 60px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

/* ==========================================================================
   RESPONSIVO
   ========================================================================== */
@media (max-width: 860px) {
  .featured-post-card {
    grid-template-columns: 1fr;
  }
  .featured-media {
    min-height: 240px;
  }
}

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .posts-grid {
    grid-template-columns: 1fr;
  }
  .intro-title {
    font-size: 1.4rem;
  }
}
