/* ==========================================================================
   OBSERVATORIO SOCIOLÓGICO DE MEDIOS - CORE CSS
   Diseño unificado: Variables, Topbar, Botones y Tipografía
   ========================================================================== */

:root {
  /* Paleta de Colores Definitiva */
  --ink:      #18212f; 
  --ink-2:    #394456; 
  --ink-3:    #707d91;
  --paper:    #fff8eb; 
  --paper-2:  #f7edd9; 
  --white:    #ffffff;
  --rule:     #e6d8bf; 
  --rule-l:   #f0e6d2;
  --red:      #ef476f; 
  --red-s:    #fff0f4;
  --amber:    #f28c28; 
  --amber-s:  #fdf5e6;
  --green:    #06a77d; 
  --green-s:  #e9fbf5;
  --blue:     #2563eb; 
  --blue-s:   #eef3fc;

  /* Tipografías */
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, sans-serif;
  
  /* Sombras y utilidades */
  --shadow: 0 18px 45px rgba(24, 33, 47, .08);
}

/* --------------------------------------------------------------------------
   RESET GLOBAL
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: 92px; }

body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 12% 0%, rgba(239,71,111,.14), transparent 28rem),
    radial-gradient(circle at 92% 8%, rgba(6,167,125,.12), transparent 24rem),
    var(--paper);
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--sans); }

/* --------------------------------------------------------------------------
   NAVEGACIÓN SUPERIOR (.topbar)
   Maneja ambas versiones: fija al tope (Red) y flotante (Comparador)
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  z-index: 5000;
  width: 100%;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all 0.3s ease;
}

/* Versión pegada al borde superior (ej. index, red_limpia) */
.topbar.topbar-fixed {
  top: 0;
  border-bottom: 1px solid rgba(24,33,47,.12);
  box-shadow: 0 4px 20px rgba(24,33,47,.07);
}

/* Versión flotante con bordes redondeados (ej. comparador, metodologia) */
.topbar.topbar-floating {
  top: 10px;
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  border: 1px solid rgba(24,33,47,.12);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.topbar-inner {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 52px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-weight: 700; font-size: 1rem;
  padding-right: 16px; border-right: 1px solid var(--rule);
}

.brand-mark {
  width: 38px; height: 38px; border-radius: 13px;
  background: linear-gradient(135deg, var(--red), var(--amber));
  box-shadow: 0 10px 24px rgba(239,71,111,.24);
  color: var(--white); display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: .9rem; flex-shrink: 0;
}

.nav { display: flex; align-items: stretch; }
.nav a {
  display: flex; align-items: center; padding: 0 14px;
  font-size: .78rem; font-weight: 800; color: var(--ink-2);
  border-left: 1px solid var(--rule); transition: background .12s, color .12s;
}
.nav a:hover  { background: var(--ink); color: var(--white); }
.nav a.active { background: var(--red); color: var(--white); border-color: var(--red); }

/* --------------------------------------------------------------------------
   BOTONES E INTERFAZ BASE
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; font-family: var(--sans); font-size: .72rem;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  border: 1.5px solid var(--ink); border-radius: 6px;
  background: var(--white); color: var(--ink); cursor: pointer;
  transition: background .1s, color .1s, border-color .1s;
}
.btn:hover { background: var(--ink); color: var(--white); }
.btn.primary { background: var(--ink); color: var(--white); }
.btn.primary:hover { background: var(--red); border-color: var(--red); }

/* Estados genéricos */
.empty { font-size: .84rem; color: var(--ink-3); font-style: italic; padding: 8px; }
.loading { font-size: .84rem; color: var(--ink-3); padding: 8px; }

/* ==========================================================================
   OBS_GLOBAL_MENU_V2
   Menú global único del Observatorio.
   No depende de .topbar para evitar choques con estilos anteriores.
   ========================================================================== */

.obs-global-menu {
  position: sticky;
  top: 10px;
  z-index: 9000;
  width: min(1440px, calc(100% - 32px));
  margin: 14px auto 22px;
  border: 1px solid rgba(24,33,47,.12);
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 45px rgba(24,33,47,.08);
  overflow: hidden;
}

.obs-global-menu-inner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  min-height: 58px;
}

.obs-global-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 360px;
  padding: 0 18px;
  color: var(--ink);
  text-decoration: none;
  border-right: 1px solid var(--rule);
}

.obs-global-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--red), var(--amber));
  color: var(--white);
  font-family: var(--serif);
  font-weight: 800;
  font-size: .9rem;
  box-shadow: 0 10px 24px rgba(239,71,111,.24);
}

.obs-global-brand-text {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.1;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.obs-global-nav {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  flex: 1;
}

.obs-global-nav a {
  display: flex;
  align-items: center;
  padding: 0 17px;
  border-left: 1px solid var(--rule);
  color: var(--ink-2);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 850;
  letter-spacing: .01em;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}

.obs-global-nav a:hover {
  background: var(--ink);
  color: var(--white);
}

.obs-global-nav a.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

.obs-home-tools {
  width: min(1440px, calc(100% - 32px));
  margin: -8px auto 22px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.obs-home-tools .btn {
  min-height: 36px;
}

@media (max-width: 980px) {
  .obs-global-menu {
    top: 6px;
    width: min(100% - 18px, 1440px);
    margin-top: 8px;
    border-radius: 16px;
  }

  .obs-global-menu-inner {
    flex-direction: column;
  }

  .obs-global-brand {
    min-width: 0;
    width: 100%;
    min-height: 56px;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }

  .obs-global-nav {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .obs-global-nav a {
    min-height: 46px;
  }

  .obs-home-tools {
    justify-content: flex-start;
    margin-top: -10px;
  }
}

@media (max-width: 620px) {
  .obs-global-brand-text {
    white-space: normal;
    font-size: .95rem;
  }

  .obs-global-nav a {
    padding: 0 13px;
    font-size: .78rem;
  }
}
